package com.lzy.pattern.factory.factory_method;

import com.lzy.pattern.factory.simple_factory.AmericanCoffee;
import com.lzy.pattern.factory.simple_factory.LatteCoffee;

/**
 * @ClassName: CoffeeStore
 * @Description: TODO
 * @Author: LiuZy
 * @Date: 2022/4/11 20:16
 * @Version: 1.0
 */
public class CoffeeStore {

    private CoffeeFactory factory;

    public void setFactory(CoffeeFactory factory) {
        this.factory = factory;
    }

    public Coffee order(){

        Coffee coffee = factory.createCoffee();
        coffee.addMilk();
        coffee.addSugar();
        System.out.println(coffee.getName());

        return coffee;
    }
}